import type { FunctionComponent } from "react";
import { isString } from "@/utils/is";
import { Icon } from "@/components/Icon";
import React from "react";

export const TreeIcon: FunctionComponent = ({ icon }: { icon: React.ReactNode | string | undefined }) => {
	if (!icon) return null;
	if (isString(icon)) return React.createElement(Icon, { icon, className: "mr-1" });

	return React.createElement(Icon);
};
